package controller.KeyListeners;

import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.util.HashMap;

import javax.swing.KeyStroke;
import model.command.Command;
import controller.Controller;

public class EnterKeyListener extends KeyboardListener{
        private Command command;
        private Controller controller;
	public EnterKeyListener(Controller controller){
		setController(controller);
		keyBindings.put(KeyStroke.getKeyStroke(10,0), new Action(){
			//TODO
			//Code for Enter based command
			public void perform() {
                            exe();
                        }
		});
	}
        private void exe(){
        	if(command == null){System.out.println("\t\t\t\t\t\t\t\t\tCOMMAND NULL");}
        	else if(command.clone() == null){System.out.println("\t\t\t\t\t\t\t\t\tCOMMAND NULL");}
            controller.queueCommandInPlayable(command.clone());
        }
        /**
         *
         * @param command
         */
        public void setCommand(Command command){
            this.command = command;
        }
        /**
         * 
         * @param controller
         */
        public void setController(Controller controller){
            this.controller = controller;
        }
}
